package com.wd.tech.model;

import com.wd.tech.bean.BeannerBean;
import com.wd.tech.contreantert.Contreatnert;
import com.wd.tech.utils.NetUtils;

import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * @author 时文豪
 * @description:
 * @date :2020/7/2 15:45
 */
public class Model implements Contreatnert.IModel {
    @Override
    public void OnSuccess(MyBeannerCoallack coallack) {
        NetUtils.getInstance().getApis().getSuccessBeanner().subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<BeannerBean>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(BeannerBean beannerBean) {
                        if(coallack!=null){
                            coallack.BannerSuccess(beannerBean);
                        }
                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }
}
